using System;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;

namespace UwinEducation.Domain.Entities
{
    /// <summary>
    /// 系统配置基类
    /// </summary>
    [Table("sys_configs")]
    public class SystemConfig : EntityBase
    {
        /// <summary>
        /// 配置ID
        /// </summary>
        public Guid Id { get; set; }

        /// <summary>
        /// 配置键
        /// </summary>
        [Required]
        [MaxLength(100)]
        public string Key { get; set; }

        /// <summary>
        /// 配置值
        /// </summary>
        [Required]
        [MaxLength(1000)]
        public string Value { get; set; }

        /// <summary>
        /// 配置描述
        /// </summary>
        [MaxLength(500)]
        public string? Description { get; set; }

        //11年级升级到毕业班，设置为第二年的某个月


        /// <summary>
        /// 创建配置
        /// </summary>
        public static SystemConfig Create(string key, string value, string description = null)
        {
            return new SystemConfig
            {
                Id = Guid.NewGuid(),
                Key = key,
                Value = value,
                Description = description,
                CreatedAt = DateTime.Now
            };
        }
    }
} 